package com.xintoucloud.xxx.springquartz;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.xintoucloud.gsv.entity.SuperVision;
import com.xintoucloud.gsv.service.SuperVisionService;

@Component
@EnableScheduling
public class SuperVisionQuartz {
	@Autowired
	private SuperVisionService superVisionService;
	@Scheduled(cron = "0 0/1 * * * ?")
    public void sendMessage() throws ParseException{
		Date date=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //System.out.println("发起督办更新时间:"+sdf.format(date));
		//先从数据库中查询
		List<SuperVision> list=superVisionService.list();
		for (SuperVision superVision : list) {
			Date startDate=sdf.parse(superVision.getStartTime());
			//System.out.println("发起时间:"+superVision.getStartTime()+"差的秒数："+(long)(date.getTime()-startDate.getTime()));
			if((long)(date.getTime()-startDate.getTime())<60000&&superVision.getSuperVisionState().getStid()==2) {
				//System.out.println("执行定时任务督查标题:"+superVision.getSvTitle()+",督查发起时间:"+sdf.format(startDate));
			
			}
		}        
    }
	
}
